﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PDS_ANDU.Entidades;
using PDS_ANDU.DTO;
using PDS_ANDU.Controles;

namespace PDS_ANDU.GUI
{
    public partial class Editor : Form
    {
        public Editor()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void Editor_Load(object sender, EventArgs e)
        {
            this.Location = new Point(this.MdiParent.ClientSize.Width / 2 - this.Width / 2, this.MdiParent.ClientSize.Height / 2 - this.Height / 2);



        }

        private void button1_Click(object sender, EventArgs e)
        {
            
            PublicarNoticia nuevaNoticia = new PublicarNoticia();
            nuevaNoticia.MdiParent = this.MdiParent;
            nuevaNoticia.Show();
            this.Hide();
            

            
            
        }

        private void Editor_Shown(object sender, EventArgs e)
        {
            ControlEditor control = new ControlEditor();

            foreach (DTONotificacion noticia in control.getNoticias())
            {
                listView1.Items.Add("" + noticia.Numero);
                listView1.Items[listView1.Items.Count - 1].SubItems.Add(noticia.Titulo);
                listView1.Items[listView1.Items.Count - 1].SubItems.Add(noticia.Resumen);
            }
        }

        private void Editor_FormClosing(object sender, FormClosingEventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Editor_FormClosed(object sender, FormClosedEventArgs e)
        {
            Login ventanaLogin = new Login();
            ventanaLogin.MdiParent = this.MdiParent;
            ventanaLogin.Show();
        }
    }
}
